package entity

import (
	"time"

	"shqsoft.cn/pasnj/base"

	"github.com/jinzhu/gorm"
)

//LSJJXSDR 基金销售导入
type LSJJXSDR struct {
	ID     int        `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	DTID   int        `gorm:"column:DTID"`
	JYLS   string     `gorm:"column:JYLS"`
	KHMC   string     `gorm:"column:KHMC"`
	ZJHM   string     `gorm:"column:ZJHM"`
	YWMC   string     `gorm:"column:YWMC"`
	JYJG   string     `gorm:"column:JYJG"`
	TAMC   string     `gorm:"column:TAMC"`
	CPDM   string     `gorm:"column:CPDM"`
	CPMC   string     `gorm:"column:CPMC"`
	JYRQ   *time.Time `gorm:"column:JYRQ;type:date"`
	QRRQ   *time.Time `gorm:"column:QRRQ;type:date"`
	QRJE   float64    `gorm:"column:QRJE"`
	SXF    float64    `gorm:"column:SXF"`
	KHJL   string     `gorm:"column:KHJL"`
	KHJLMC string     `gorm:"column:KHJLMC"`
	GSZH   string     `gorm:"column:GSZH"`
	JYJE   float64    `gorm:"column:JYJE"`
	SXF2   float64    `gorm:"column:SXF2"`
	FY     float64    `gorm:"column:FY"`
	DRJG   string     `gorm:"column:DRJG"`
}

//TableName 房贷导入
func (LSJJXSDR) TableName() string {
	return "T_INDI_JJSX_FYDR_DTIP"
}

//FdAfterImport 导入后执行分户处理
func LSJJXSDRAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	prams := make([]interface{}, 1)
	prams[0] = params["DTID"]
	tx.Exec("EXEC UP_INDI_JJSX_FYDR ?", prams...)
	return nil
}

//LSJJXSDREF 返回结构体
func LSJJXSDREF() base.EntityFunc {
	return func() interface{} {
		entity := LSJJXSDR{}
		return &entity
	}
}

//LSJJXSDRESF 返回结构体数组
func LSJJXSDRESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []LSJJXSDR
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("LSJJXSDR", base.NewDefaultDao(LSJJXSDREF(), LSJJXSDRESF(), nil))
	base.SetAfterCallBack("LSJJXSDR", LSJJXSDRAfterImport)
}
